<?php class PapiWS_Model_PersonalizedProduct extends Ext_Db_Table {
	protected $_name = 'pr_personalized_product';
	protected $_sequence = 'pr_personalized_product_seq';
	protected $_primary = 'personalized_product_id';

	public function insert( array $data ) {
		$object = $data['object'];
		unset( $data['object'] );
		$id = parent::insert( $data );

		if ( $id !== null ) { 
			$db = $this->getAdapter();
			$sql = "update pr_personalized_product set object = :obj where personalized_product_id = :id";
			$res = $db->query( $sql, array( ':obj' => $object, ':id' => $id ) );
		}
		
		return $id;
	}
}
